/*
 * tools.c
 *
 *  Created on: 23.10.2011
 *      Author: David
 */

#include "tools.h"


void u82bcd(u8 val,u8 result[])
{
  char i;

  i = '0' - 1;
  do
    i++;
  while( !((val -= 100) & 0x80));
  result[2] = i;

  i = '0' + 10;
  do
    i--;
  while( (val += 10) & 0x80);
  result[1] = i;

  result[0] = val | '0';
}
